*********************FA4. GENDER GAPS****************************

clear all
use Clean_data, clear


*A. Gender Gaps- Mean*

global dropout dropout

foreach x in $dropout {
reg `x' i.female##i.year z_GPA if degree=="M"  & GPA!=. & foreign==0 , robust 

frame create `x' year or orlb orub
forvalues j=1983/2019{
*if inlist(`j',1987,1988) continue
lincom _b[1.female] + _b[`j'.year#1.female] 
frame post `x' (`j') (`r(estimate)') (`r(lb)') (`r(ub)')
}
frame change `x'
isid year, sort
format or %3.2f
format orlb %3.2f
format orub %3.2f
list, noobs clean
 

twoway (rarea orlb orub year,fcolor(gs6%50) fintensity(inten50) lwidth(none)) ///
 	(line or year, lcolor(black) lwidth(medthick)), /// 
    graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) ///
  ytitle("`x'") xtitle(" ",size(small)) ///
    xlabel(1983(6)2019, labsize(small) angle(45)) yline(0, lcolor(grey) lpattern(shortdash)) legend(off)

graph save "DropoutGG.gph", replace
frame change default 
} 



global z_test z_answered z_test_correct 
foreach x in $z_test {
reg `x' i.female##i.year z_GPA  if degree=="M" & test==1 & (year<1987 | year>1988) & GPA!=. & foreign==0 , robust 

frame create `x' year or orlb orub
forvalues j=1983/2019{
if inlist(`j',1987,1988) continue
lincom _b[1.female] + _b[`j'.year#1.female] 
frame post `x' (`j') (`r(estimate)') (`r(lb)') (`r(ub)')
}
frame change `x'
isid year, sort
format or %3.2f
format orlb %3.2f
format orub %3.2f
list, noobs clean

twoway (rarea orlb orub year,fcolor(gs6%50) fintensity(inten50) lwidth(none)) ///
 	(line or year, lcolor(black) lwidth(medthick)), /// 
    graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) ///
  ytitle("`x'") xtitle(" ",size(small)) ///
    xlabel(1983(6)2019, labsize(small) angle(45)) yline(0, lcolor(grey) lpattern(shortdash)) legend(off)

graph save "`x'GG.gph", replace
frame change default 
} 


global z_notest_  z_test_points z_total_points position 	
 
 foreach x in $z_notest_ {
reg `x' i.female##i.year  z_GPA  if degree=="M" & test==1 & GPA!=. & foreign==0, robust

frame create `x' year or orlb orub
forvalues j=1983/2019{
lincom _b[1.female] + _b[`j'.year#1.female] 
frame post `x' (`j') (`r(estimate)') (`r(lb)') (`r(ub)')
}
frame change `x'
isid year, sort
format or %3.2f
format orlb %3.2f
format orub %3.2f
list, noobs clean

twoway (rarea orlb orub year,fcolor(gs6%50) fintensity(inten50) lwidth(none)) ///
 	(line or year, lcolor(black) lwidth(medthick)), /// 
    graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) ///
  ytitle("`x'") xtitle(" ",size(small)) ///
    xlabel(1983(6)2019, labsize(small) angle(45)) yline(0, lcolor(grey) lpattern(shortdash)) legend(off)

graph save "`x'GG.gph", replace
frame change default 
} 


**COMBINE ALL GRAPHS***
graph combine DropoutGG.gph z_answeredGG.gph z_test_correctGG.gph z_test_pointsGG.gph z_total_pointsGG.gph PositionGG.gph, graphregion(color(white)) cols(2) ysize(11.7) xsize(8.3)

